Skip to content

Make the output filename flexible and change default to ISO 8601 datetime - #30

Merged
KristianHMoller merged 8 commits into
dmidk:mainfrom
KristianHMoller:feature/flexible_output_filename
Nov 13, 2026
Merged

KristianHMoller merged 8 commits into
dmidk:mainfrom
KristianHMoller:feature/flexible_output_filename

Conversation

@KristianHMoller

@KristianHMoller KristianHMoller commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

This PR adds the option of providing a custom output filename format as opposed to this being hardcoded. The custom output filename format can be specified for a given dataset in config.yaml as currently done for KNMI_MTG.

Additionally, the default output filename format has been changed to have an ISO 8601-compliant datetime format.
Default output filename format: SolarNowcast_YYYY-MM-DDTHHMMZ.nc
Selected output filename format for KNMI_MTG: SolarNowcast_MTG-CPP_YYYY-MM-DDTHHMMZ.nc
For legacy reasons, the default remains unchanged with KNMI_MSG: SolarNowcast_YYYYMMDDHHMM.nc

With this PR, the filename_format previously used in the config.yaml for the input filename format has been changed to input_filename_format, so runs with old config.yaml files will fail.

Additional flexibility has been added to allow the INPUT_FILENAME_FORMAT and OUTPUT_FILENAME_FORMAT environment variables to overwrite the corresponding filename formats so that the formats can be set without changing the code.

Finally, the dataset variable has been added to the metadata of the output NetCDF file with the label satellite_data_source for transparency.

@KristianHMoller KristianHMoller changed the title Make the output filename flexible and change default to ISO8601 datetime Make the output filename flexible and change default to ISO 8601 datetime Nov 12, 2026
@KristianHMoller
KristianHMoller marked this pull request as ready for review November 12, 2026 08:55

@elenibriola elenibriola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes, Kristian! The implementation looks good overall and I like the additional flexibility for configuring filenames through environment variables.

I have a few comments/questions:

  1. Would it make sense to include the dataset name in the default output filename to avoid potential collisions when different datasets are processed for the same timestamp and stored in the same location?
  2. I will add a few unit tests for the filename generation and configuration precedence. I will start the pr for it these days. I think it is time.

Otherwise the changes look good to me!

Comment thread sunflow/data_io.py Resolved
@KristianHMoller

Copy link
Copy Markdown
Collaborator Author

Excellent idea with the dataset in the default output filename.
Implemented with:
c3c4a0e

@elenibriola
elenibriola self-requested a review November 13, 2026 09:59

@elenibriola elenibriola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have nothing else to add. Looks good to me! Nice work!

@KristianHMoller
KristianHMoller merged commit 61206b0 into dmidk:main Nov 13, 2026
2 checks passed
@KristianHMoller
KristianHMoller deleted the feature/flexible_output_filename branch November 13, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants